import json
# 字符串转JSON
data = [{"name":"张打上","age":18},{"name":"里哈哈","age":122}]
json_str = json.dumps(data,ensure_ascii=False)
# ensure_ascii=False 添加了这一条则会显示中文
print(type(json_str))
print(json_str)

# JSON转Python数据类型
data = '[{"name":"张打上","age":18},{"name":"里哈哈","age":122}]'
json_data = json.loads(data)
print(type(json_data))
print(type(json_data[0]))
print(json_data)